<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html>
<head>
<title>商品分类</title>
<%@ include file="../../../common/admin_taglib.jsp" %>
<link rel="stylesheet" type="text/css" href="${ctx}/resources/js/jquery-easyui-1.3.3/themes/bootstrap/easyui.css">
<link rel="stylesheet" type="text/css" href="${ctx}/resources/js/jquery-easyui-1.3.3/themes/icon.css">
<script type="text/javascript" src="${ctx}/resources/js/jquery-easyui-1.3.3/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${ctx}/resources/js/jquery-easyui-1.3.3/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript">
$(function(){
	$("#deleteConfirm_ok").click(function(){
		if (bid > 0)
			location.href='${ctx}/admin/categ/delete/' + bid;
	});
});
function formatOperate(value) {
	var str = "<a class='btn btn-mini btn-info' href='${ctx}/admin/categ/update/"+value+"'>编辑</a>&nbsp;&nbsp;";
	str += "<a class='btn btn-mini btn-danger' href='javascript:deleteItem("+value+");'>删除</a>";
	return str;
}
var bid = 0;
function deleteItem(value) {
	$("#deleteConfirm").modal("show");
	bid = value;
}
function reloadGrid() {
	$(".easyui-treegrid").treegrid("reload");
}
</script>
</head>
<body>

<dd:messager id="deleteConfirm" type="confirm"></dd:messager>

<h1 class="page-title">Shop4j 管理中心</h1>
<ul class="breadcrumb">
	 <li><a href="${ctx}/admin/main">管理中心</a><span class="divider">/</span></li>
     <li class="active">商品分类</li>
</ul>

<div class="row-fluid">
	<div class="btn-toolbar">
	    <a href="${ctx}/admin/categ/insert" class="btn btn-primary"><i class="icon-plus"></i>添加商品分类</a>
	  	<a href="javascript:reloadGrid();" class="btn">刷新</a>
	  	<div class="btn-group"></div>
	</div>
	<div class="well">
		<table title="商品分类列表" class="easyui-treegrid" style="width:990px;height:350px"
			data-options="
				url: '${ctx}/admin/categ/gridTree',
				rownumbers: true,
				idField: 'id',
				treeField: 'name'
			">
			<thead>
				<tr>
					<th data-options="field:'name'" width="350">分类名</th>
					<th data-options="field:'code'" width="100">分类code</th>
					<th data-options="field:'sortOrder'" width="50">排序</th>
					<th data-options="field:'seoKeyword'" width="250">SEO关键字</th>
					<th data-options="field:'id',formatter:formatOperate" width="100">操作</th>
				</tr>
			</thead>
		</table>
	</div>
</div>

</body>
</html>